﻿Imports System.Data.OleDb

Public Class AddNewQuestion
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
        Dim p1 As New OleDbParameter("@f1", txtTitle.Text)
        Dim p2 As New OleDbParameter("@f2", txtDesc.Text)
        Dim p3 As New OleDbParameter("@f3", User.Identity.Name)
        Dim p4 As New OleDbParameter("@f3", Format(Date.Now(), "dd/MM/yyyy hh:mm:ss tt"))
        Dim sql As String = "insert into CricQuestion(QTitle,QDescription,CreatedBy,CreatedDate) values (@f1,@f2,@f3,@4)"

        Dim body As String = " <h2> Update from Cricket Forum !</h2><p> Hello, " & User.Identity.Name & " has added new Question " & txtTitle.Text & " <p> Please Visit the site to answer!</p>  <p> Thanks!<br />Cricket Forum</p>"
        GeneralMethods.SendMail(User.Identity.Name & " has Added New Cricket Question", body)

        DataAccessLayer.ExecuteNonQuery(sql, p1, p2, p3, p4)
        Response.Redirect("~/CricGossip.aspx")
    End Sub
End Class